package edit;

import java.util.ArrayList;

import skyproc.GRUP;
import skyproc.MajorRecord;
import skyproc.Mod;
import skyproc.SPGlobal;
import skyproc.exceptions.NotFound;

public abstract class StaticRecordHolder implements HolderInterface {
	
	protected static MajorRecord record;
	protected static ArrayList<Mod> masters;
	
	public StaticRecordHolder(MajorRecord record) {
		masters = new ArrayList<Mod>();
				
		for(Mod mod : SPGlobal.getDB()) {
			for(GRUP grup : mod.getGRUPs().values()) {
				if(grup.contains(record.getForm())) {
					masters.add(mod);
				}
			}
		}
		
		try {
			StaticRecordHolder.record = masters.get(0).getRecord(record.getForm());
		} catch (NotFound e) {
			e.printStackTrace();
		}
		
	}
	
	public static ArrayList<Mod> getMasters() {
		return masters;
	}
	
	public static MajorRecord getRecord() {
		return record;
	}

}
